#!-*- encoding:utf8 -*-
#所有策略函数均在此定义,名称规定如:strategy_fun
#输入参数（straData, data)
#straData为检查设置值
#data为采集值
#返回结果为一个元组（状态码，信息串）
import time

def strategy_connect(straData, data):
    print "xxxxxxxxxxxxxxxxxxxxxxxxx"
    if data.find(":") > 0:
        return (True, 'ok')
    try:
        code = int(data)
        if code < 0:
            print "[%s][check error, code:%s]" % (time.ctime(), code)
            if code == -1:
                return (False, "connect error")
            else:
                return (False, "error, code: %s" -(code) )
        else:
            print "[%s][check ok, code:%s]" % (time.ctime(), code)
            return (True, "ok")
    except:
        return (False, "paste error")
